<?php
if (isset($query) && count($query) > 0) {
    ?>
    <h1>Data Pengiriman</h1>
    <table width="400" border="1" class="table table-striped">
        <thead>
            <tr>
                <th>#</th>
                <th>Job order</th>
                <th>Consgnee</th>
                <th>Origin</th>
                <th>ETD SIN</th>
                <th>ETA JKT</th>
                <th>Delivery</th>
                <th colspan="2">Print</th>
                <th>Edit</th>
                
            </tr>
        </thead>
        <?php
        $i = 0;
        foreach ($query as $row) {
            $i++;
            echo "<tr class=\"record\">";
            echo "<td>$i</td>";
            echo "<td>$row->job_order</td>";
            echo "<td>$row->consgnee</td>";
            echo "<td>$row->origin</td>";
            if($row->etd_sin == null){
               echo "<td><strong style='color:red;'>Unknown</strong></td>"; 
            }
            else{
            echo "<td>$row->etd_sin</td>";
            }
            if($row->eta_jkt == null){
               echo "<td><strong style='color:red;'>Unknown</strong></td>"; 
            }
            else{
            echo "<td>$row->eta_jkt</td>";
            }
            if($row->delivery == null){
               echo "<td><strong style='color:red;'>Unknown</strong></td>"; 
            }
            else{
            echo "<td>$row->delivery</td>";
            }
            if ($row->agree == 'Y'){
                echo "<td><a href='" . base_url() . "pegawai1/cetak/$row->id_order' class='input btn btn-info btnPrint'>Print</a></td>";
            }
            else{
                echo "<td></td>";
            }
            if ($row->agree == 'Y'){
                echo "<td><a href='" . base_url() . "pegawai1/cetakjalan/$row->id_order' class='input btn btn-info btnPrint'>Print SJ</a></td>";
            }
            else{
                echo "<td></td>";
            }
            echo "<td><a href='" . base_url() . "pegawai1/edits/$row->id_order' class='fancybox fancybox.iframe input btn btn-primary'>Details</a></td>";
            //echo "<td><a href='" . base_url() . "pegawai1/delconf/$row->id_order' class='fancybox fancybox.iframe input'>Delete</a></td>";
            echo "</tr>";
        }
        ?>
    </table>
    <?php
}
?>